define(function(require, exports, module) {

    rootIden = [];

    Op = {
      EQ: "==",
      SEQ: "skip"
    };

    Local = {
        Root: function() {
            return '$root$';
        },
        Var: function(value) {
            return value;
        },
        OutputVar: function(value) {
            if( rootIden.indexOf(value) != '-1' ) return Local.Root() + '.getString("g0")';
            return value + '.getString("g0")';
        },
        LoopStart: function(name) {
            return '$result$.getIteration("' + name + '").forEach(' + name + '){\n';
        },
        End: function() {
            return '});\n';
        }
    }

    Remote = {
        Root: function() {
            return 'root';
        },
        Var: function(value) {
            if( rootIden.indexOf(value) != '-1' )
                return Remote.Root();
            return value;
        },
        OutputVar: function(value) {
            if( rootIden.indexOf(value) != '-1' )
                return 'g0:' + Remote.Root();
            return 'g0:' + value;
        },
        LoopStart: function(name) {
            return 'for ' + name + ' in ';
        },
        LoopBlock: function() {
            return ' do ';
        },
        End: function() {
            return ' end';
        },
        IfStart: function() {
            return 'if ('
        },
        IfBlock: function() {
            return ') then ';
        }
    }

    setRootIden = function(r) {
        rootIden = r;
    }

    exports.setRootIden = setRootIden;
    exports.Op = Op;
    exports.Local = Local;
    exports.Remote = Remote;
});